#ifndef WIREFRAME_H
#define WIREFRAME_H

#include "defs.h"
#include "method/filler.h"
#include "model/vertex.h"

class Wireframe: public Filler {
public:
    virtual void draw(QWidget* container, Scene *scene);
};

class ZBuffer: public Filler {
protected:

    struct Edge {
        coord x, z;
        coord ix, iz;
        coord max;

        Edge(const Vertex &begin, const Vertex &end) {
            coord height = (end.y - begin.y);

            this->x = begin.x;
            this->z = begin.z;
            this->ix = (end.x - begin.x)/height;
            this->iz = (end.z - begin.z)/height;
            this->max = end.y;
        }

        bool operator < (const Edge& other) const {
            return this->x < other.x;
        }

        Edge& operator++ () {
            x += ix;
            z += iz;
            return *this;
        }
    };

public:
    virtual void draw(QWidget *container, Scene *projection);
};

#endif // WIREFRAME_H

